package org.yonggan.cmcc.report.RealTimeReportDateChain

import org.apache.spark.rdd.RDD
import org.yonggan.cmcc.report.biz.{RealTimeReportTradeData, RechargeProvinceDistributionData, RechargeTotalData}

/**
  * 实时业务业务处理链
  */
trait RealTimeRechargeHandler {

  /**
    * 业务处理
    *
    * @param rdd
    */
  def handler(rdd: RDD[(List[Double],String,String,String,String)]){}

}

/**
  * 实时总量统计
  *
  */
trait RechargeTotalDataHandler extends RealTimeRechargeHandler {


  override
  def handler(rdd: RDD[(List[Double],String,String,String,String)]): Unit = {

    RechargeTotalData.realTimeGrossData(rdd)
    super.handler(rdd)

  }

}


/**
  * 统计每个省份的充值失败数据量
  */
trait RechargeProvinceDataHandler extends RealTimeRechargeHandler {

  override def handler(rdd: RDD[(List[Double],String,String,String,String)]): Unit = {
    RechargeProvinceDistributionData.RechargeDataGroupedProvince(rdd)
    super.handler(rdd)
  }

}



/**
  * 实时按照时间统计
  */
trait RechargeReportTradeDataHandler extends RealTimeRechargeHandler {

  override
  def handler(rdd: RDD[(List[Double],String,String,String,String)]): Unit = {
    RealTimeReportTradeData.reportTradeDataByMin(rdd)
    super.handler(rdd)
  }

}




